package br.com.trumah.dao.impl;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import br.com.trumah.dao.interfaces.PerfilDAO;
import br.com.trumah.model.Beneficiario;
import br.com.trumah.model.Coordenadas;
import br.com.trumah.model.Perfil;
import br.com.trumah.utils.HibernateUtil;

public class PerfilDAOImpl implements PerfilDAO {

	@Override
	public void salvar(Perfil perfil) {
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction t = session.beginTransaction();
		session.save(perfil);
		t.commit();
	}

	@Override
	public Perfil obterPerfil(long id) {
		Session session = HibernateUtil.getSessionFactory().openSession();
		return (Perfil) session.load(Perfil.class, id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Perfil> listar() {
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction t = session.beginTransaction();
		List<Perfil> lista = session.createQuery("from Perfil").list();
		t.commit();
		return lista;
	}

	@Override
	public void remover(Perfil perfil) {
		// TODO Auto-generated method stub

	}

	@Override
	public void atualizar(Perfil perfil) {
		// TODO Auto-generated method stub

	}

}
